$(function() {
//	$("#header").load('header.html', function() {
//		loadHeader(0)
//	});
	$("#footer").load('footer.html', function() {});
	$('#new').carousel({
		interval: 1000
	});

	//	轮播图
	$.ajax({
		type: "post",
		url: host + '/CMSAPI/MainInList',
		dataType: 'JSON',
		data: {
			index: 1,
			size: 10,
			categorys: 167,
			menuID: 5,
			cid: cid
		},
		success: function(res) {
			var main = res.data.list
			if(res.state) {
				var html1 = '',
					html2 = ''
				for(var i = 0; i < main.length; i++) {
					html1 += `<li data-target="#myCarousel" data-slide-to="${i}" class="cicle" ></li>`
					html2 += `<div class="item">
								<div class='index-banner' style='background-image:url(${main[i].images[0].URL});'  onclick="location.href='detail.html?id=${main[i].id}'"></div>
							</div>`
				}
				$('.carousel-indicators').append(html1);
				$('.carousel-inner').append(html2);
				$('.cicle:eq(0)').addClass('active');
				$('.item:eq(0)').addClass('active');

				$('.carousel').carousel({
					interval: 2500
				});
			}
		}
	});

	$.ajax({
		url: host + '/CMSAPI/MainInList',
		type: 'post',
		dataType: 'JSON',
		data: {
			menuID: 5,
			cid: cid,
			categorys: 183,
			index: 1,
			size: 15

		},
		success: function(res) {
			var obj = res.data.list
			if(res.state) {
				var html = ''
				$.each(obj, function(i, item) {
					html += `<li class="list-item" onclick="location.href='pay.html?id=${item.id}'">
								<div class="main">${item.title}</div>
								<div class="time">${item.publishDate}</div>
							</li>
							`
				});
				$('.list-list1').append(html)
			} else {

			}
		},
		error: function() {}
	});
	$.ajax({
		url: host + '/CMSAPI/MainInList',
		type: 'post',
		dataType: 'JSON',
		data: {
			menuID: 5,
			cid: cid,
			categorys: 184,
			index: 1,
			size: 10

		},
		success: function(res) {
			var obj = res.data.list
			if(res.state) {
				var html = ''
				$.each(obj, function(i, item) {
					html += `<li class="list-item" onclick="location.href='pay.html?id=${item.id}'">
								<div class="main">${item.title}</div>
								<div class="time">${item.publishDate}</div>
							</li>
							`
				});
				$('.list-list2').append(html)
			} else {

			}
		},
		error: function() {}
	});

	$.ajax({
		url: host + '/CMSAPI/MainInList',
		type: 'post',
		dataType: 'JSON',
		data: {
			menuID: 5,
			cid: cid,
			categorys: 164,
			index: 1,
			size: 4

		},

		success: function(res) {
			var obj = res.data.list
			if(res.state) {
				var html = ''
				$.each(obj, function(i, item) {
					html += `<li><img src="${item.images[0].URL}" /></li>`
				});
				$('.mate-list').append(html)
			} else {

			}
		},
		error: function() {}
	});

})